home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / cshell / shell.h < prev    next >
C/C++ Source or Header  |  1992-11-09  |  7KB  |  283 lines

  1. /*
  2.  * SHELL.H
  3.  *
  4.  * (c)1986 Matthew Dillon     9 October 1986
  5.  *
  6.  *
  7.  * SHELL include file.. contains shell parameters and extern's
  8.  *
  9.  * Version 2.07M by Steve Drew 10-Sep-87
  10.  * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90
  11.  * Version 5.00L by Urban Mueller 16-Mar-91
  12.  *
  13.  */
  14.  
  15. #define RAW_CONSOLE 1   /* Set to 0 to compile out command line editing */
  16.  
  17. /* uncommented by AMK for SAS/C 6.1 */
  18. /* #define strlen strlen */
  19.  
  20. #ifdef _DCC
  21. # define C_Args
  22. # define FUNCARG(x,y,z) ()
  23. #else
  24. # define FUNCARG(x,y,z) (x,y,z)
  25. # define KICK20
  26. #endif
  27.  
  28.  
  29. /* AMK: more includes for OS 2.0 */
  30.  
  31. #include <exec/types.h>
  32. #include <exec/exec.h>
  33. #include <exec/memory.h>
  34. #include <graphics/gfxbase.h>
  35. #include <graphics/text.h>
  36. #include <intuition/intuitionbase.h>
  37. #include <libraries/dos.h>
  38. #include <libraries/dosextens.h>
  39. #include <libraries/gadtools.h>
  40. #include <libraries/asl.h>
  41. #include <time.h>
  42. #include <ctype.h>
  43. #include <fcntl.h>
  44. #include <stdio.h>
  45. #include <stdlib.h>
  46. #include <string.h>
  47. #include <math.h>
  48. #include <dos/datetime.h>
  49. #include <dos/dosextens.h>
  50. #include <dos/dostags.h>
  51. #include <dos/var.h>
  52. #include <utility/tagitem.h>
  53. #include <resources/battclock.h>
  54.  
  55.  
  56. /* Magnus Lilja, lilja@lysator.liu.se, IRC: lilja - for multiuser-support */
  57. //#define MULTIUSER_SUPPORT 0
  58. //#ifdef MULTIUSER_SUPPORT
  59. //# include <libraries/multiuser.h>
  60. //# include <proto/multiuser.h>
  61. //# include <pragmas/multiuser.h>
  62. //  extern struct muBase *muBase;
  63. //#endif
  64.  
  65.  
  66. LONG AllocPattern    (STRPTR, ULONG);
  67. LONG MatchThePattern (LONG, STRPTR);
  68. void FreePattern     (LONG);
  69.  
  70.  
  71. typedef struct FileInfoBlock FIB;
  72.  
  73. #ifdef AZTEC_C
  74. # include <functions.h>
  75. # define DEVTAB(x)    (BPTR)(_devtab[x->_unit].fd)
  76. # define CHARSWAIT(x) (x->_bp < x->_bend)
  77. # define RESETIO(x)   (x->_bp = x->_bend)
  78. # define COMPILER "Aztec C 5.0d"
  79. # pragma amicall(PatternBase, 0x48, AllocPattern(a0,d0))
  80. # pragma amicall(PatternBase, 0x60, MatchThePattern(d0,a0))
  81. # pragma amicall(PatternBase, 0x66, FreePattern(d0))
  82. #endif
  83.  
  84. #ifdef LATTICE
  85. # include <proto/all.h>
  86. # include <ios1.h>
  87. /* # define DEVTAB(x)    _ufbs[(x)->_file].ufbfh*/
  88. # define DEVTAB(x)    __ufbs[(x)->_file].ufbfh
  89. # define CHARSWAIT(x) (x->_rcnt != x->_wcnt)
  90. # define RESETIO(x)   (x->_rcnt =  x->_wcnt)
  91.  
  92.   /* AMK: already defined in <ios1.h>, extern struct UFB _ufbs[];*/
  93. # ifndef memmove
  94. # define memmove(t,f,l) movmem((f),(t),(l))
  95. # endif
  96. # define COMPILER "SAS/C 6"
  97. # define swapmem(x,y,z) swmem(x,y,z)
  98. # pragma libcall PatternBase AllocPattern 48 0802
  99. # pragma libcall PatternBase MatchThePattern 60 8002
  100. # pragma libcall PatternBase FreePattern 66 001
  101. #endif
  102.  
  103. #ifdef _DCC
  104. # define COMPILER "DICE 2.06"
  105. # define DEVTAB(x)    (_IoFD[x->sd_Fd].fd_Fh)
  106. # define CHARSWAIT(x) (x->sd_RPtr != x->sd_RBuf)
  107. # define RESETIO(x)   (x->sd_RPtr =  x->sd_RBuf)
  108. # define index strchr
  109. # define rindex strrchr
  110.   void * AllocMem(long byteSize, long requirements);
  111.   struct MsgPort *FindPort( UBYTE *name );
  112. #endif
  113.  
  114. #undef  toupper
  115. #define toupper(c)    ((c)>='a'&&(c)<='z'?((c)-('a'-'A')):(c))
  116.  
  117. #ifndef MAX
  118. #define MAX(x,y) ((x)>(y) ? (x) : (y))
  119. #endif
  120.  
  121. #define OPT(x) (options & (x))
  122.  
  123. #define MAXSRC        5        /* Max. # of source file levels    */
  124. #define MAXIF        20        /* Max. # of if levels            */
  125. #define MAXALIAS    20        /* Max. # of alias levels        */
  126. #define MAXMYFILES    9        /* Max. # of internal files        */
  127. #define MAXHASH        32        /* Max. # of hash chains        */
  128. #define MAXFILENAME    30
  129.  
  130. #define LEVEL_SET        0        /* which variable list to use   */
  131. #define LEVEL_ALIAS        1
  132. #define LEVEL_LABEL        2
  133. #define LEVEL_LOCAL        256
  134.  
  135. #define SBYTE signed char
  136. #define MAXMENUS    31    /* GadTools maximum */
  137. #define MAXMENUITEMS    63    /* GadTools maximum */
  138.  
  139. #define VERBOSE_SOURCE 1
  140. #define VERBOSE_ALIAS  2
  141. #define VERBOSE_HILITE 4
  142.  
  143. #define SCAN_FILE     1
  144. #define SCAN_DIR      2
  145. #define SCAN_RECURSE  4
  146. #define SCAN_DIRENTRY 8
  147. #define SCAN_DIREND   16
  148.  
  149. #ifndef NULL
  150. #define NULL 0L
  151. #endif
  152.  
  153. #define CHECKBREAK() dobreak()
  154. #define ISSPACE(c) ((c)==' ' || (c)==9 || (UBYTE)(c)==0xA0)
  155.  
  156. #ifndef AZTEC_C
  157. struct _dev {
  158.     long  fd;
  159.     short mode;
  160.     };
  161. #endif
  162.  
  163. typedef struct hnode {
  164.     struct hnode *next, *prev;        /* doubly linked list */
  165.     char *line;                /* line in history    */
  166. } HIST;
  167.  
  168. typedef struct PErr {
  169.     int errnum;                /* Format of global error lookup */
  170.     char *errstr;
  171. } PERROR;
  172.  
  173. #ifdef MA_AMK
  174. #undef MA_AMK
  175. #endif
  176. /* #define MA_AMK 1 /* */
  177. typedef struct dirptr {                /* Format of directory fetch pointer */
  178.     BPTR lock;                /* lock on directory   */
  179.     FIB *fib;                /* mod'd fib for entry */
  180. #ifdef MA_AMK
  181.     struct DevProc *dvp;            /* for multi-assigns */
  182.     char *dname;                /* for multi-assigns */
  183. #endif
  184. } DPTR;
  185.  
  186. extern HIST *H_head, *H_tail;
  187. extern PERROR Perror[];
  188. extern char **av;
  189. extern char *Current;
  190. extern int  H_len, H_tail_base, H_stack, H_num;
  191. extern int  E_stack;
  192. extern int  Src_stack, If_stack, forward_goto;
  193. extern int  ac;
  194. extern int  max_ac;
  195. extern int  debug, Rval, Verbose, disable, Quit;
  196. extern int  Lastresult, atoierr;
  197. extern int  Exec_abortline;
  198. extern int  S_histlen;
  199. extern unsigned int options;
  200.  
  201. extern FILE *Src_base[MAXSRC];
  202. extern long  Src_pos[MAXSRC];
  203. extern short Src_if[MAXSRC], Src_abort[MAXSRC];
  204. extern char  If_base[MAXIF];
  205. extern struct Process *Myprocess;        /* The shell's process  */
  206. extern struct CommandLineInterface *Mycli;    /* Cli() */
  207. extern struct DosPacket *Mypacket;        /* initialization packet from AmigaDOS */
  208.  
  209. extern char v_titlebar[], v_prompt[], v_hist[], v_histnum[], v_debug[],
  210.     v_verbose[], v_stat[], v_lasterr[], v_cwd[], v_except[], v_passed[],
  211.     v_path[], v_gotofwd[], v_linenum[], v_every[], v_lcd[], v_rxpath[],
  212.     v_hilite[], v_scroll[], v_minrows[], v_result[], v_qcd[], v_noreq[],
  213.     v_value[], v_nobreak[], v_bground[], v_pipe[], v_datefmt[], v_ioerr[],
  214.     v_abbrev[], v_rback[], v_insert[], v_failat[], v_clipri[],
  215.     v_dirformat[], v_nomatch[], v_prghash[], v_cquote[];
  216.  
  217. extern char o_hilite[], o_lolite[], o_rback[], *o_csh_qcd, o_internal;
  218. extern char o_aux, o_minrows, o_scroll, o_nowindow, o_noraw, o_vt100;
  219. extern char o_nofastscr, o_nobreak, o_bground, o_resident, o_nomatch;
  220. extern char o_cquote;
  221. extern char o_pipe[], o_datefmt, o_abbrev, o_insert, *o_every;
  222. extern long o_noreq, o_failat;
  223. extern char Buf[], isalph[], confirmed, asked, *classfile;
  224.  
  225. extern char *MyMem;
  226.  
  227. #define isalphanum(x) isalph[x]
  228.  
  229. typedef struct file_info {
  230.     LONG flags;
  231.     LONG type;
  232.     LONG size;
  233.     LONG blocks;
  234.     char class[12];
  235.     struct DateStamp date;
  236.     UWORD uid;
  237.     UWORD gid;
  238. } FILEINFO;
  239.  
  240. typedef struct pattern {
  241.     int  casedep;
  242.     int  queryflag;
  243.     LONG patptr;
  244.     char pattern[1];
  245. } PATTERN;
  246.  
  247. #define INFO_COMMENT (1<<30)
  248. #define INFO_INFO    (1<<29)
  249.  
  250. typedef struct Class {
  251.     struct Class *next;
  252.     char name[1];
  253. } CLASS;
  254.  
  255. extern CLASS *CRoot, *LastCRoot;
  256. extern struct Window *Mywindow;
  257.  
  258. extern long IoError;
  259.  
  260. typedef struct VNode {
  261.     struct VNode *next;
  262.     long len;
  263.     char *text;
  264.     char name[1];
  265. } NODE;
  266.  
  267. typedef struct VRoot {
  268.     NODE         *first[MAXHASH];
  269.     struct VRoot *parent;
  270. } ROOT;
  271.  
  272. struct PathList {
  273.     BPTR pl_NextPath;
  274.     BPTR pl_PathLock;
  275. };
  276.  
  277. /* internal programm path hash-list */
  278. extern char **prghash_list;
  279. extern long prghash_num;
  280.  
  281. #include "proto.h"
  282.  
  283.